package com.itlong.cloud.user.operate;

import com.itlong.cloud.POJO.DTO.operate.OperateGroupGetPageDTO;
import com.itlong.cloud.POJO.PO.OperateGroupPO;
import com.itlong.cloud.utils.page.Page;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;


/**
 * <desc>
 *      运营-组织业务处理暴露接口
 * </desc>
 *
 * @createDate 2017/09/21
 */
@FeignClient(name = "user-service")
public interface IOperateGroupServiceClient {

    /**
     * <desc>
     *      获取分页列表
     * </desc>
     *
     * @return page
     * @author Jiaqi.X
     * @createDate 2017/09/15
     */
    @RequestMapping(path = "/operate/system/group/getPage")
    Page<OperateGroupPO> getPage(OperateGroupGetPageDTO pageDTO) throws Exception;



    /**
     * <desc>
     *      保存组织
     * </desc>
     *
     * @param operateGroupPO
     * @return
     * @author Jiaqi.X
     * @createDate 2017/09/14
     */
    @RequestMapping(path = "/operate/system/group/save")
    Integer save(@RequestBody OperateGroupPO operateGroupPO) throws Exception;



    /**
     * <desc>
     *      更新组织
     * </desc>
     *
     * @param operateGroupPO
     * @return
     * @author Jiaqi.X
     * @createDate 2017/09/14
     */
    @RequestMapping(path = "/operate/system/group/updateGroup")
    Integer update(@RequestBody OperateGroupPO operateGroupPO) throws Exception;

    /**
     * <desc>
     *      根据id查询组织
     * </desc>
     *
     * @param operateGroupPO 组织实体
     * @return
     * @author Jiaqi.X
     * @createDate 2017/09/27
     */
    @RequestMapping(path = "/operate/system/group/getOne")
    public OperateGroupPO getOne(@RequestBody OperateGroupPO operateGroupPO);

    /**
     * <desc>
     *      禁用或启用组织
     * </desc>
     *
     * @param operateGroupPO 组织实体
     * @return
     * @author Jiaqi.X
     * @createDate 2017/09/27
     */
    @RequestMapping(path = "/operate/system/group/banOrUse")
    public Integer banOrUse(@RequestBody OperateGroupPO operateGroupPO) throws Exception;

    /**
     * <desc>
     *      获取所有组织
     * </desc>
     *
     * @return
     * @author Jiaqi.X
     * @createDate 2017/09/29
     */
    @RequestMapping(path = "/operate/system/group/getList")
    public List<OperateGroupPO> getList();

    /**
     * <desc>
     *       部门分配人员
     * </desc>
     *
     * @param groupId    部门id
     * @param allotUsers    需要分配的人员id 多个，号分隔
     * @param userIds 当前列表所有人员id 多个，号分隔
     * @return sql执行行数
     * @author Jiaqi.X
     * @createDate 2017/10/10
     */
    @RequestMapping(path = "/operate/system/group/saveGroupUsers")
    Integer saveGroupUsers(
            @RequestParam("groupId")String groupId,
            @RequestParam(value = "allotUsers",required = false)String allotUsers,
            @RequestParam("userIds")String userIds) throws Exception;
}
